import request from './request'

// 健康检查
export const getHealth = () => request.get('/health')

// 路由管理
export const getRoutes = () => request.get('/api/admin/routes')
export const createRoute = (data: any) => request.post('/api/admin/routes', data)
export const updateRoute = (id: string, data: any) =>
  request.put(`/api/admin/routes/${id}`, data)
export const deleteRoute = (id: string) =>
  request.delete(`/api/admin/routes/${id}`)

// 监控指标
export const getMetrics = () => request.get('/metrics')
export const getPrometheusMetrics = () =>
  request.get('/metrics', {
    headers: {
      Accept: 'application/json',
    },
  })

// 日志
export const getLogs = (params?: {
  page?: number
  pageSize?: number
  level?: string
  startTime?: string
  endTime?: string
}) => request.get('/api/admin/logs', { params })

// 认证配置
export const getAuthConfig = () => request.get('/api/admin/config/auth')
export const updateAuthConfig = (data: any) =>
  request.put('/api/admin/config/auth', data)

// 限流配置
export const getRateLimitConfig = () =>
  request.get('/api/admin/config/rate-limit')
export const updateRateLimitConfig = (data: any) =>
  request.put('/api/admin/config/rate-limit', data)

// 系统配置
export const getSystemConfig = () => request.get('/api/admin/config')
export const updateSystemConfig = (data: any) =>
  request.put('/api/admin/config', data)

// 配置重载
export const reloadConfig = () => request.post('/api/admin/config/reload')

// 统计数据
export const getStatistics = () => request.get('/api/admin/statistics')


